import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-02-28
 * Time: 22:29
 */

public class TestDemo {
//递归求1+2+3+....+10的和
    public static int addfact(int n){

        if(n==1){
            return 1;
        }else{
            return n+addfact(n-1);
        }
    }
    public static void main(String[] args) {
               int n=0;
                Scanner scanner=new Scanner(System.in);
                n=scanner.nextInt();
                addfact(n);
        System.out.println( addfact(n));
    }





    //递归求N得阶乘
     public    static long fact(int n)
    {
        if(n <= 1)
        {
            return 1;
        }
        else
        {
            return n * fact(n - 1);
        }
    }

    public static void main1(String[] args) {
        int i=0;
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你要求得阶乘");
        i=scanner.nextInt();
        fact(i);
        System.out.println(fact(i));


    }
}
